package com.eastfair.venuebooking.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.eastfair.boot.request.PageParams;
import com.eastfair.boot.service.SuperService;
import com.eastfair.venuebooking.dto.*;
import com.eastfair.venuebooking.entity.BusinessOpportunity;
import com.eastfair.venuebooking.entity.VenueBookAudit;
import com.eastfair.venuebooking.vo.BusinessOpportunityVO;

import java.util.List;

/**
 * <p>
 * 业务接口
 * 商机
 * </p>
 *
 * @author linan
 * @date 2022 -06-08
 */
public interface BusinessOpportunityService extends SuperService<BusinessOpportunity> {

    /**
     * 分页查询商机.
     *
     * @param pageParams the page params
     * @return the page
     */
    IPage<BusinessOpportunityVO> listBusinessOpportunityVOs(PageParams<BusinessOpportunityQuery> pageParams);

    /**
     * id 获取商机详情.
     *
     * @param id the id
     * @return the business opportunity vo
     */
    BusinessOpportunityVO getBusinessOpportunityVOById(Long id);

    /**
     * 线索ID查询关联的商机.
     *
     * @param saleClueId the sale clue id
     * @return the by sale clue id
     */
    BusinessOpportunityDTO getBySaleClueId(Long saleClueId);

    /**
     * 商机是否存在.
     *
     * @param query the query
     * @return the boolean true：存在/false：不存在
     */
    boolean existBusinessOpportunity(BusinessOpportunityQuery query);

    /**
     * 客户ID查询商机是否存在.
     *
     * @param customerIds the customer ids
     * @return the boolean true：存在/false：不存在
     */
    boolean existBusinessOpportunityByCustomerIds(List<Long> customerIds);

    /**
     * 线索ID查询商机是否存在.
     *
     * @param saleClueIds the sale clue ids
     * @return the boolean true：存在/false：不存在
     */
    boolean existBusinessOpportunityBySaleClueIds(List<Long> saleClueIds);

    /**
     * 新增商机.
     *
     * @param saveDTO the save dto
     * @return the boolean
     */
    BusinessOpportunity saveBusinessOpportunity(BusinessOpportunityDTO saveDTO);

    /**
     * 场馆预定审核通过生成商机.
     *
     * @param venueBookAudit the website venue book dto
     * @param customerMainId      the customer main id
     * @param customerMainName    the customer main name
     * @param contactId           the contact id
     * @param contactName         the contact name
     * @param exhibitionId        the exhibition id
     * @return the boolean
     */
    BusinessOpportunity saveForVenueBook(VenueBookAudit venueBookAudit, Long customerMainId, String customerMainName, Long contactId, String contactName, Long exhibitionId);

    /**
     * 更新商机.
     *
     * @param updateDTO the update dto
     * @return the boolean
     */
    boolean updateBusinessOpportunity(BusinessOpportunityDTO updateDTO);

    /**
     * 更新商机， 不保存展会客户关系.
     *
     * @param updateDTO the update dto
     * @return the boolean
     */
    BusinessOpportunity updateBusinessOpportunityWithoutExhibitionCustomer(BusinessOpportunityDTO updateDTO);

    /**
     * 商机保存展会客户关系，并更新线索.
     *
     * @param businessOpportunityDTO the business opportunity dto
     * @return the boolean
     */
    boolean saveExhibitionCustomerAndUpdateSaleCLue(BusinessOpportunityDTO businessOpportunityDTO);

    /**
     * 商机保存展会客户关系.
     *
     * @param businessOpportunityDTO the business opportunity dto
     * @return the exhibition customer dto
     */
    ExhibitionCustomerDTO saveExhibitionCustomer(BusinessOpportunityDTO businessOpportunityDTO);

    /**
     * 更新跟进信息.
     *
     * @param updateDTO the update dto
     * @return the boolean
     */
    boolean updateFollow(BusinessOpportunityDTO updateDTO);

    /**
     * 跟新跟进信息.
     *
     * @param followRecordPlanSaveDTO the follow record plan save dto
     * @return the boolean
     */
    boolean updateFollow(FollowRecordPlanSaveDTO followRecordPlanSaveDTO);

    /**
     * 更新商机归属.
     *
     * @param assignDTO the assign dto
     * @return the boolean
     */
    boolean updateBelongTo(BusinessOpportunityAssignDTO assignDTO);

    /**
     * 更新商机归属.
     *
     * @param updateDTO the update dto
     * @return the boolean
     */
    boolean updateBelongTo(BusinessOpportunityDTO updateDTO);

    /**
     * 线索更新商机的举办类型.
     *
     * @param exhibitionCustomerDTO the business opportunity dto
     * @return the boolean
     */
    boolean updateCustomerIdentityBySaleClue(ExhibitionCustomerDTO exhibitionCustomerDTO);

    /**
     * 移除商机.
     *
     * @param ids the ids
     * @return the boolean
     */
    boolean removeBusinessOpportunityByIds(List<Long> ids);

    /**
     * 获取全部商机
     *
     * @return
     */
    List<BusinessOpportunity> getBusinessOpportunityList(SalesAnalysisDTO salesAnalysisDTO);




    IPage<BusinessOpportunityVO> getBusinessOpportunityPageList(PageParams<SalesAnalysisDTO> pageParams);

    /**
     * 客户ID统计商机数量.
     *
     * @param customerId the customer id
     * @return the long
     */
    long countBusinessOpportunityByCustomerId(Long customerId);
}
